package com.deyuanyun.pic.ctrl.enumeration;

import com.deyuanyun.pic.ctrl.domain.*;
import com.deyuanyun.pic.ctrl.mapper.*;

/**
 * @Description 六大干扰源类型枚举
 * @author Jerry
 * @date 2017-01-09
 */
public enum InterferenceEnum {

    HVDCTS(4,"高压直流输电系统干扰源基础信息表", InfluenceDcerMapper.class, InfluenceDcer.class,"高压直流输电系统"),//高压直流输电系统
    DCTS(4,"直流牵引系统干扰源基础信息表", InfluenceActowMapper.class, InfluenceActow.class,"直流牵引系统"),//直流牵引系统
    OCPS(4,"其它阴极保护系统直流干扰源基础信息表", InfluenceCpOtherMapper.class, InfluenceCpOther.class,"其他阴极保护系统"),//其他阴极保护系统
    ODEF(3,"其它直流用电设施干扰源基础信息表",InfluenceDcotherMapper.class, InfluenceDcother.class,"其他直流用电设施"),//其他直流用电设施
    THVACTS(4,"高压交流输电系统干扰源基础信息表", InfluenceHtacMapper.class, InfluenceHtac.class,"高压交流输电系统"),//高压交流输电系统
    ACERS(3,"交流电气化铁路系统干扰源基础信息表",InfluenceAcerMapper.class,InfluenceAcer.class,"交流电气化铁路系统");//交流电气化铁路系统
    //OCEF("其他交流用电设施");


    //9大设备运行记录导出excel模板路径
    private String[] expExcelPathStrs = {"/template/excl/ctrl/influence-dcer.xlsx", "/template/excl/ctrl/influence-acow.xlsx", "/template/excl/ctrl/influence-cpother.xlsx",
            "/template/excl/ctrl/influence-dcother.xlsx", "/template/excl/ctrl/influence-htac.xlsx", "/template/excl/ctrl/influence-acer.xlsx"};


    private int tempExpIndex; //导出模板数组中的下标,
    private String expName; //模板导出名字
    private Class mapperCls; //对应的mapper
    private Class domainCls; //对应的实体
    private String label;//对应的注释

    private InterferenceEnum(int tempExpIndex, String expName, Class mapperCls, Class domainCls,String label) {
        this.tempExpIndex = tempExpIndex;
        this.expName = expName;
        this.mapperCls = mapperCls;
        this.domainCls = domainCls;
        this.label = label;
    }

    public int getTempExpIndex() {
        return tempExpIndex;
    }

    public String getExpName() {
        return expName;
    }

    public Class getMapperCls() {
        return mapperCls;
    }

    public Class getDomainCls() {
        return domainCls;
    }

    public String getLabel() { return label;}



    /**
     * 获取导出模板的路径
     * @return
     */
    public String getExpExcelPath() {
        return expExcelPathStrs[this.ordinal()];
    }

    public static InterferenceEnum getInstance(String str) {
        InterferenceEnum[] interEnum = InterferenceEnum.values();
        for (InterferenceEnum interferenceEnum : interEnum) {
            String name = interferenceEnum.name();
            if (name.equals(str)) {
                return interferenceEnum;
            }
        }
        return interEnum[0];
    }

    /**
     * 通过enum获取对应的label
     * @param code
     * @return
     */
    public static String getLabel(String code)
    {

        InterferenceEnum  rs[]=InterferenceEnum.values();
        for(int i=0,end=rs.length;i<end;i++)
        {
            if(rs[i].name().equals(code))
            {
                return rs[i].getLabel();
            }
        }
        return null;
    }

    /**
     * 通过注释找到对应的enum
     * @param lable
     * @return
     */
    public static InterferenceEnum getEnum(String lable)
    {

        InterferenceEnum  rs[]=InterferenceEnum.values();
        for(int i=0,end=rs.length;i<end;i++)
        {
            if(rs[i].getLabel().equals(lable))
            {
                return rs[i];
            }
        }
        return null;
    }


}
